package com.rider.model;

import java.sql.Date;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.text.SimpleDateFormat;
import org.json.JSONArray;

import com.member.model.MemberVO;

public class CarRiderPathJsonHandler {

	
	public CarRiderPathJsonHandler() {
		super();
	}

	public JSONArray toJSONArray(List<CarRiderPathVO> car_rider_pathList) {
		ArrayList<HashMap> list = new ArrayList<HashMap>();
		for (CarRiderPathVO car_rider_path : car_rider_pathList) {
			HashMap map = new HashMap();
			
			DateFormat df = new SimpleDateFormat("yyyy-MM-dd  HH:mm:ss");  
	
			String member_id = car_rider_path.getMember_id();		
			Integer distance=car_rider_path.getDistance();
			Integer share_fee = car_rider_path.getShare_fee();
			String start_point=car_rider_path.getStart_point();
			String departure_date = df.format(car_rider_path.getDeparture_date());
			String end_point = car_rider_path.getEnd_point();
			String arrival_date = df.format(car_rider_path.getArrival_date());
			Integer status = car_rider_path.getStatus();
			Integer company = car_rider_path.getCompany();
			String pool_type = car_rider_path.getPool_type();	
			String order_id =car_rider_path.getOrder_id();
			
			map.put("member_id", member_id);
			map.put("distance", distance);
			map.put("share_fee", share_fee);
			map.put("start_point", start_point);
			map.put("departure_date", departure_date);
			map.put("end_point", end_point);
			map.put("arrival_date", arrival_date);
			map.put("status", status);
			map.put("company", company);
			map.put("pool_type", pool_type);
			map.put("order_id",order_id);

			list.add(map);		
			
		}
		JSONArray car_rider_Json = new JSONArray(list);
		return car_rider_Json;
	}

	
	
	
	
	
	
	
	
}
